a = int(input("请输入一个数:"))
qian=a // 1000
# print(qian)

bai=a % 1000 // 100
# print(bai)

shi=a % 100 // 10
# print(shi)

ge=a % 10 // 1
# print(ge)

print(ge+shi+bai+qian)